package top.tangyh.lamp.care.mapper;

import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import top.tangyh.basic.base.mapper.SuperMapper;
import top.tangyh.lamp.care.entity.BWorkRoles;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Set;

/**
 * <p>
 * Mapper 接口
 * 角色和排班关系中间表
 * </p>
 *
 * @author zqb
 * @date 2024-07-18 15:42:26
 * @create [2024-07-18 15:42:26] [zqb] [代码生成器生成]
 */
@Repository
public interface BWorkRolesMapper extends SuperMapper<BWorkRoles> {

    default List<BWorkRoles> selectListByWorkIds(Set<Long> workIds) {
        LambdaQueryWrapper<BWorkRoles> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.in(CollectionUtil.isNotEmpty(workIds), BWorkRoles::getWorkId, workIds);
        return this.selectList(queryWrapper);
    }


    default void deleteByWorkId(Long workId) {
        LambdaQueryWrapper<BWorkRoles> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(BWorkRoles::getWorkId, workId);
        this.delete(queryWrapper);
    }
}


